#include "tcp_server.hpp"
#include <unistd.h>
#include "Daemon.hpp"
void Usage(const string &arg) {
    lg(WARNING, "\tUsage:./server <binded_port>");
} 

int main(int argc, char *argv[]) {
    if(argc != 2) {
        Usage(argv[0]);
        return 1;
    }
    uint16_t port = stoi(argv[1]);
    calculator cal;
    tcp_server server(port, bind(&calculator::calculate, &cal, placeholders::_1));
    server.init();
    daemon(1, 0);
    server.run();
    return 0;
}